/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Jiang Jinxi
 * Date: 2024-08-28
 * Time: 10:50
 */
public class Demo8 {
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(() -> {
            for(int i = 0; i < 6; i++){
                System.out.println("thread");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
            System.out.println("thread end");
        });
        thread.start();
        for (int i = 0; i < 3; i++) {
            System.out.println("main");
            Thread.sleep(1000);
        }
        thread.join();
        System.out.println("main end");
    }
}
